package com.wsdcd.zlg.sb.controller;

import com.wsdcd.zlg.sb.model.entity.User;
import com.wsdcd.zlg.sb.model.service.UserService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@AllArgsConstructor
@RequestMapping("/user")
public class UserController {
    private final UserService userService;

    @RequestMapping()
    public String list(Model model){
        List<User> users = userService.list();
        model.addAttribute("users", users);
        return "user/list";
    }
}
